﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TB.BLL
{
    public class MpUserInfo
    {
        private DALFactory.DALFactory dataFactory = DataProvider.DefaultProvider;

        public int InsertSubscribeUser(Entity.MpUserInfo user)
        {
            return dataFactory.DALMpUserInfoProvider.Insert(user);
        }

        public int UpdateSubscribeUser(string toUserName, string fromUserName,string realToUserName, string subscribeKind,string createTime)
        {
            Entity.MpUserInfo user = new Entity.MpUserInfo();
            user.toUserName = toUserName;
            user.fromUserName = fromUserName;
            user.subscribe = subscribeKind;
            user.createTime = createTime;
            user.realToUserName = realToUserName;
            return dataFactory.DALMpUserInfoProvider.Update(user);
        }

        public int Update(TB.Entity.MpUserInfo userEntity)
        {
            return dataFactory.DALMpUserInfoProvider.UpdateUser(userEntity);
        }

        /// <summary>
        /// 判断用户是否存在
        /// </summary>
        /// <param name="toUserName"></param>
        /// <param name="fromUserName"></param>
        /// <returns></returns>
        public bool IsExist(string toUserName, string fromUserName)
        {
            Entity.MpUserInfo user=dataFactory.DALMpUserInfoProvider.LoadById(toUserName, fromUserName);
            if (user == null)
            {
                return false;
            }
            else
            {
                return true;
            }
        }

        public System.Data.DataSet GetDataSet(string strSql)
        {
            return dataFactory.DALMpUserInfoProvider.GetDataSet(strSql);
        }
    }
}
